salary = input("欢迎使用购物系统\n可随时输入quit退出程序\n请输入你的工资：")
if salary == 'quit':
    exit()
commodity = {'1': 'apple', '2':  'banana', '3': 'potato', '4': 'water'}
commodity1 = {'apple': '3', 'banana': '4', 'potato': '5', 'water': '1'}
for i in commodity:
    print("商品编号是：{}，商品是：{}，价格是：{}".format(i, commodity[i], commodity1[commodity[i]]))
num1 = input("请输入您要购买的商品的编号：")
if num1 == 'quit':
    exit()
num2 = input("请输入您想购买几个：")
if num2 == 'quit':
    exit()
num2 = int(num2)
commodity1[commodity[num1]] = int(commodity1[commodity[num1]])
price = commodity1[commodity[num1]] * num2
salary = int(salary)
price = int(price)
if salary >= price:
    balance = salary - price
    print(balance)
else:
    print("您的余额已不足，请及时充值。")